import React, { useEffect, useState } from 'react'
import { useNavigate } from 'react-router-dom'
function Index() {
    let navigate=useNavigate();
    let [isLogin,setIsLogin]=useState(false)
    let token=localStorage.getItem('token');
    useEffect(()=>{
     if(token){
        setIsLogin(true);
     }else{
        setIsLogin(false);
        navigate('/login')
     }
    },[])
  return {isLogin:isLogin}
}

export default Index